package map.utils.overlayutil;

import android.graphics.Color;

import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.Marker;
import com.baidu.mapapi.map.OverlayOptions;
import com.baidu.mapapi.map.Polyline;
import com.baidu.mapapi.map.PolylineOptions;
import com.baidu.mapapi.map.TextOptions;
import com.baidu.mapapi.model.LatLng;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author ：zhong.jw
 * @date ：Created in 2022/12/12 11:32
 */
public class LineOverlay extends OverlayManager {


    private final List<LatLng> points = new ArrayList<>();
    private int color;

    /**
     * 通过一个BaiduMap 对象构造
     *
     * @param baiduMap:
     */
    public LineOverlay(BaiduMap baiduMap) {
        super(baiduMap);
    }

    public void bindData(List<LatLng> points) {
        this.bindData(points, Color.argb(1, 255, 0, 0));
    }

    public void bindData(List<LatLng> points, int color) {
        this.points.clear();
        this.points.addAll(points);
        this.color = color;
    }

    @Override
    public List<OverlayOptions> getOverlayOptions() {
        return Collections.singletonList(new PolylineOptions().points(points).color(color));
    }

    @Override
    public boolean onMarkerClick(Marker marker) {
        return false;
    }

    @Override
    public boolean onPolylineClick(Polyline polyline) {
        return false;
    }
}
